package com.resign.carl.singleton.impl;

/**
 * 单例模式 -- 静态内部类
 * Created by carl.zhao on 2016/6/14.
 */
public class Singleton {

    private Singleton(){}

    private static class SingletonHolder{
        private final static Singleton instance = new Singleton();
    }

    public static Singleton getInstance(){
        return SingletonHolder.instance;
    }

    public static void main(String[] args) {
        System.out.println(Singleton.getInstance() == Singleton.getInstance());
    }
}
